package com.log.enhance.config;

import com.alibaba.fastjson.JSON;
import com.log.enhance.constant.LogConst;

/**
 * 日志上下文
 *
 * @author Mr_wenpan@163.com 2021/5/29 7:47 下午
 */
public class LogContext {
    /**
     * 操作类型
     */
    private LogConst.Action action;
    /**
     * 对象类型
     */
    private String itemType;
    /**
     * 对象ID
     */
    private String[] itemIds;
    /**
     * 在高于debug的日志输出级别下，是否打印debug级别日志
     */
    private boolean printDebugLog;
    /**
     * 开启方法调用耗时统计（暂时不用）
     */
    private boolean enableProfiler;
    /**
     * 分线器名称，不传默认为方法名称（暂时不用）
     */
    private String profilerName;
    /**
     * 如果是数组 是否打印出参大小，不打印对象值
     */
    private boolean printOutParamSize;
    /**
     * 需要排除不打印的入参
     */
    private String[] excludeInParam;
    /**
     * 需要打印的入参
     */
    private String[] includeInParam;
    /**
     * （其他）参数
     */
    private String[] param;

    private boolean enableLog;

    public LogConst.Action getAction() {
        return action;
    }

    public void setAction(LogConst.Action action) {
        this.action = action;
    }

    public String getItemType() {
        return itemType;
    }

    public void setItemType(String itemType) {
        this.itemType = itemType;
    }

    public String[] getItemIds() {
        return itemIds;
    }

    public void setItemIds(String[] itemIds) {
        this.itemIds = itemIds;
    }

    public boolean isPrintDebugLog() {
        return printDebugLog;
    }

    public void setPrintDebugLog(boolean printDebugLog) {
        this.printDebugLog = printDebugLog;
    }

    public boolean isEnableProfiler() {
        return enableProfiler;
    }

    public void setEnableProfiler(boolean enableProfiler) {
        this.enableProfiler = enableProfiler;
    }

    public String getProfilerName() {
        return profilerName;
    }

    public void setProfilerName(String profilerName) {
        this.profilerName = profilerName;
    }

    public boolean isPrintOutParamSize() {
        return printOutParamSize;
    }

    public void setPrintOutParamSize(boolean printOutParamSize) {
        this.printOutParamSize = printOutParamSize;
    }

    public String[] getExcludeInParam() {
        return excludeInParam;
    }

    public void setExcludeInParam(String[] excludeInParam) {
        this.excludeInParam = excludeInParam;
    }

    public String[] getIncludeInParam() {
        return includeInParam;
    }

    public void setIncludeInParam(String[] includeInParam) {
        this.includeInParam = includeInParam;
    }

    public String[] getParam() {
        return param;
    }

    public void setParam(String[] param) {
        this.param = param;
    }

    public boolean isEnableLog() {
        return enableLog;
    }

    public void setEnableLog(boolean enableLog) {
        this.enableLog = enableLog;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }
}
